package com.cxc.singleton;


import java.util.concurrent.CountDownLatch;

public class TestDemo3 {
	
	public static void main(String[] args) throws Exception {
		
		long start = System.currentTimeMillis();
		int threadNum = 100;
		final CountDownLatch  countDownLatch = new CountDownLatch(threadNum);
		
		for(int i=0;i<threadNum;i++){
			new Thread(new Runnable() {

				public void run() {

					for(int i=0;i<1000000;i++){
//						Object o = StaticInnerSingleton.getInstance();//
//						Object o = EnumerationSingleton.INSTANCE;//
//						Object o = LazySingleton.getInstance();//
//						Object o = HungryManSingleton.getInstanace();//

					}

					countDownLatch.countDown();
				}
			}).start();
		}
		
		countDownLatch.await();	//
		
		long end = System.currentTimeMillis();
		System.out.println("总耗时："+(end-start));
	}
}
